package com.baizw.cultivation;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动主函数入口
 *
 * @author 剧终1204
 * @version V1.0
 * @date 2020年04月29日 15:07:02
 */
@Slf4j
@SpringBootApplication(scanBasePackages = {"cn.hutool.extra.spring", "com.baizw.cultivation"}, exclude = SecurityAutoConfiguration.class)
public class CultivationApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(CultivationApplication.class, args);
        Environment env = application.getEnvironment();
        try {
            String ip = InetAddress.getLocalHost().getHostAddress();
            String port = env.getProperty("server.port");
            log.info("\n----------------------------------------------------------\n\t" +
                    "Application is running! Access URLs:\n\t" +
                    "Local: \t\thttp://localhost:{}/\n\t" +
                    "External: \thttp://{}:{}/\n\t" +
                    "Document: \thttp://localhost:{}/doc.html\n" +
                    "----------------------------------------------------------", port, ip, port, port);
        } catch (UnknownHostException e) {
            log.error("为获取到网卡信息", e);
        }
    }

}
